package com.luochen.cdpt.repository;

import com.luochen.cdpt.eneity.Area;
import com.luochen.cdpt.eneity.QArea;
import com.luochen.cdpt.eneity.QInsuranceCompany;
import com.luochen.cdpt.eneity.QOrgInfo;
import com.querydsl.core.types.dsl.StringPath;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.querydsl.QuerydslPredicateExecutor;
import org.springframework.data.querydsl.binding.QuerydslBinderCustomizer;
import org.springframework.data.querydsl.binding.QuerydslBindings;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;

/**
 * @Auther: star
 * @Date: 2019/1/22 16:43
 * @Description:
 */
@RepositoryRestResource(path = "/area")
public interface IAreaRepository extends PagingAndSortingRepository<Area,String>,
        QuerydslPredicateExecutor<Area>, JpaSpecificationExecutor<Area>, QuerydslBinderCustomizer<QArea> {

    default void customize(QuerydslBindings bindings, QArea qArea) {
        bindings.bind(qArea.areaName,qArea.areaCode).first(
                (StringPath path, String value) -> path.contains(value));
    }
}
